package com.atguigu.gmall.product.feign;

import com.atguigu.gmall.model.product.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * projectName: gmall
 *
 * @author: 陈鹏
 * time: 2022/9/25 16:20 星期日
 * description: 商品管理微服务提供内部调用的feign接口
 */
@FeignClient(name = "service-product",path = "/api/item",contextId = "productFeign")
public interface ProductFeign {

    /**
     * 根据skuId查询skuInfo信息
     * @param skuId
     * @return
     */
    @GetMapping("/getSkuInfo/{skuId}")
    public SkuInfo getSkuInfo(@PathVariable("skuId") Long skuId);

    /**
     * 根据category3Id查询分类信息
     * @param category3Id
     * @return
     */
    @GetMapping(value = "/getCategory/{category3Id}")
    public BaseCategoryView getCategory(@PathVariable("category3Id") Long category3Id);

    /**
     * 根据skuId查询sku图片列表
     * @param skuId
     * @return
     */
    @GetMapping(value = "/getImageList/{skuId}")
    public List<SkuImage> getImageList(@PathVariable("skuId")Long skuId);

    /**
     * 根据skuId查询商品价格
     * @param skuId
     * @return
     */
    @GetMapping(value = "/getPrice/{skuId}")
    public BigDecimal getPrice(@PathVariable("skuId")Long skuId);

    /**
     * 根据sku和spu的id查询销售属性和值以及标识出当前的sku的值是哪些
     * @param skuId
     * @param spuId
     * @return
     */
    @GetMapping(value = "/getSpuSaleAttr/{skuId}/{spuId}")
    public List<SpuSaleAttr> getSpuSaleAttr(@PathVariable("skuId")Long skuId,
                                            @PathVariable("spuId")Long spuId);

    /**
     * 根据spuId查询所有的销售属性和销售值
     * @param spuId
     * @return
     */
    @GetMapping(value = "/getSkuSaleAttrInfo/{spuId}")
    public Map getSkuSaleAttrInfo(@PathVariable(value = "spuId")Long spuId);

    /**
     * 查询品牌详情
     * @param id
     * @return
     */
    @GetMapping(value = "/getBaseTrademark/{id}")
    public BaseTrademark getBaseTrademark(@PathVariable(value = "id") Long id);

    /**
     * 根据skuId查询sku的平台属性
     * @param skuId
     * @return
     */
    @GetMapping(value = "/getBaseAttrInfoList/{skuId}")
    public List<BaseAttrInfo> getBaseAttrInfoList(@PathVariable(value = "skuId") Long skuId);

    /**
     * 扣减库存
     * @param decountMap
     */
    @GetMapping(value = "/decount")
    public void decount(@RequestParam Map<String, Object> decountMap);

    /**
     * 回滚库存
     * @param rollBackMap
     */
    @GetMapping(value = "/rollback")
    public void rollback(@RequestParam Map<String,Object> rollBackMap);
}
